home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 3 / Amiga Format CD03 (1996-07-04)(Future Publishing)(GB)(Track 1 of 6)[!][issue 1996-08].iso / comms / netsoftware / archie38_1.lha / archie-1.4 / perrmesg.c < prev    next >
C/C++ Source or Header  |  1995-01-05  |  9KB  |  206 lines

  1. /*
  2.  * Copyright (c) 1989, 1990, 1991 by the University of Washington
  3.  *
  4.  * For copying and distribution information, please see the file
  5.  * <copyright.h>.
  6.  */
  7. /* Amiga port by Tomas Willis (tomas@cae.wisc.edu) January 1995 */
  8.  
  9. #include "perrno.h"
  10. #include <stdio.h>
  11.  
  12. //protos
  13. #ifndef ARCHIE
  14. void perrmesg(char *prefix,int no, char *text);
  15. void sperrmesg(char *buf,char *prefix,int no,char *text);
  16. void pwarnmesg(char *prefix,int no,char *text);
  17. void spwarnmesg(char *buf,char *prefix,int no,char *text);
  18. #endif
  19.  
  20. /* This file and perrno.h should always be updated simultaneously */
  21.  
  22. int    perrno = 0;
  23. int    pwarn = 0;
  24. char    p_err_string[P_ERR_STRING_SZ];
  25. char    p_warn_string[P_ERR_STRING_SZ];
  26.  
  27. char    *p_err_text[256] = {
  28.     /*   0 */ "Success (prospero)",
  29.     /*   1 */ "Port unknown (dirsend)",
  30.     /*   2 */ "Can't open local UDP port (dirsend)",
  31.     /*   3 */ "Can't resolve hostname (dirsend)",
  32.     /*   4 */ "Unable to send entire message (dirsend)",
  33.     /*   5 */ "Timed out (dirsend)",
  34.     /*   6 */ "Recvfrom failed (dirsend)",
  35.     /*   7 */ "",    /*   8 */ "",    /*   9 */ "",    /*  10 */ "",
  36.     /*  11 */ "Sendto failed (reply)",
  37.     /*  12 */ "",    /*  13 */ "",    /*  14 */ "",    /*  15 */ "",
  38.     /*  16 */ "",    /*  17 */ "",    /*  18 */ "",    /*  19 */ "",
  39.     /*  20 */ "",
  40.     /*  21 */ "Link already exists (vl_insert)",
  41.     /*  22 */ "Link with same name already exists (vl_insert)",
  42.     /*  23 */ "",    /*  24 */ "",
  43.     /*  25 */ "Link already exists (ul_insert)",
  44.     /*  26 */ "Replacing existing link (ul_insert)",
  45.     /*  27 */ "Previous entry not found in dir->ulinks (ul_insert)",
  46.     /*  28 */ "",    /*  29 */ "",    /*  30 */ "",    /*  31 */ "",
  47.     /*  32 */ "",    /*  33 */ "",    /*  34 */ "",    /*  35 */ "",
  48.     /*  36 */ "",    /*  37 */ "",    /*  38 */ "",    /*  39 */ "",
  49.     /*  40 */ "",
  50.     /*  41 */ "Temporary not found (rd_vdir)",
  51.     /*  42 */ "Namespace not closed with object (rd_vdir)",
  52.     /*  43 */ "Alias for namespace not defined (rd_vdir)",
  53.     /*  44 */ "Specified namespace not found (rd_vdir)",
  54.     /*  45 */ "",    /*  46 */ "",    /*  47 */ "",    /*  48 */ "",
  55.     /*  49 */ "",    /*  50 */ "",
  56.     /*  51 */ "File access method not supported (pfs_access)",
  57.     /*  52 */ "",    /*  53 */ "",    /*  54 */ "",
  58.     /*  55 */ "Pointer to cached copy - delete on close (pmap_cache)",
  59.     /*  56 */ "Unable to retrieve file (pmap_cache)",
  60.     /*  57 */ "",    /*  58 */ "",    /*  59 */ "",    /*  60 */ "",
  61.     /*  61 */ "Directory already exists (mk_vdir)",
  62.     /*  62 */ "Link with same name already exists (mk_vdir)",
  63.     /*  63 */ "",    /*  64 */ "",
  64.     /*  65 */ "Not a virtual system (vfsetenv)",
  65.     /*  66 */ "Can't find directory (vfsetenv)",
  66.     /*  67 */ "",    /*  68 */ "",    /*  69 */ "",    /*  70 */ "",
  67.     /*  71 */ "Link already exists (add_vlink)",
  68.     /*  72 */ "Link with same name already exists (add_vlink)",
  69.     /*  73 */ "",    /*  74 */ "",    /*  75 */ "",    /*  76 */ "",
  70.     /*  77 */ "",    /*  78 */ "",    /*  79 */ "",    /*  80 */ "",
  71.     /*  81 */ "",    /*  82 */ "",    /*  83 */ "",    /*  84 */ "",
  72.     /*  85 */ "",    /*  86 */ "",    /*  87 */ "",    /*  88 */ "",
  73.     /*  89 */ "",    /*  90 */ "",    /*  91 */ "",    /*  92 */ "",
  74.     /*  93 */ "",    /*  94 */ "",    /*  95 */ "",    /*  96 */ "",
  75.     /*  97 */ "",    /*  98 */ "",    /*  99 */ "",    /* 100 */ "",
  76.     /* 101 */ "",    /* 102 */ "",    /* 103 */ "",    /* 104 */ "",
  77.     /* 105 */ "",    /* 106 */ "",    /* 107 */ "",    /* 108 */ "",
  78.     /* 109 */ "",    /* 110 */ "",    /* 111 */ "",    /* 112 */ "",
  79.     /* 113 */ "",    /* 114 */ "",    /* 115 */ "",    /* 116 */ "",
  80.     /* 117 */ "",    /* 118 */ "",    /* 119 */ "",    /* 120 */ "",
  81.     /* 121 */ "",    /* 122 */ "",    /* 123 */ "",    /* 124 */ "",
  82.     /* 125 */ "",    /* 126 */ "",    /* 127 */ "",    /* 128 */ "",
  83.     /* 129 */ "",    /* 130 */ "",    /* 131 */ "",    /* 132 */ "",
  84.     /* 133 */ "",    /* 134 */ "",    /* 135 */ "",    /* 136 */ "",
  85.     /* 137 */ "",    /* 138 */ "",    /* 139 */ "",    /* 140 */ "",
  86.     /* 141 */ "",    /* 142 */ "",    /* 143 */ "",    /* 144 */ "",
  87.     /* 145 */ "",    /* 146 */ "",    /* 147 */ "",    /* 148 */ "",
  88.     /* 149 */ "",    /* 150 */ "",    /* 151 */ "",    /* 152 */ "",
  89.     /* 153 */ "",    /* 154 */ "",    /* 155 */ "",    /* 156 */ "",
  90.     /* 157 */ "",    /* 158 */ "",    /* 159 */ "",    /* 160 */ "",
  91.     /* 161 */ "",    /* 162 */ "",    /* 163 */ "",    /* 164 */ "",
  92.     /* 165 */ "",    /* 166 */ "",    /* 167 */ "",    /* 168 */ "",
  93.     /* 169 */ "",    /* 170 */ "",    /* 171 */ "",    /* 172 */ "",
  94.     /* 173 */ "",    /* 174 */ "",    /* 175 */ "",    /* 176 */ "",
  95.     /* 177 */ "",    /* 178 */ "",    /* 179 */ "",    /* 180 */ "",
  96.     /* 181 */ "",    /* 182 */ "",    /* 183 */ "",    /* 184 */ "",
  97.     /* 185 */ "",    /* 186 */ "",    /* 187 */ "",    /* 188 */ "",
  98.     /* 189 */ "",    /* 190 */ "",    /* 191 */ "",    /* 192 */ "",
  99.     /* 193 */ "",    /* 194 */ "",    /* 195 */ "",    /* 196 */ "",
  100.     /* 197 */ "",    /* 198 */ "",    /* 199 */ "",    /* 200 */ "",
  101.     /* 201 */ "",    /* 202 */ "",    /* 203 */ "",    /* 204 */ "",
  102.     /* 205 */ "",    /* 206 */ "",    /* 207 */ "",    /* 208 */ "",
  103.     /* 209 */ "",    /* 210 */ "",    /* 211 */ "",    /* 212 */ "",
  104.     /* 213 */ "",    /* 214 */ "",    /* 215 */ "",    /* 216 */ "",
  105.     /* 217 */ "",    /* 218 */ "",    /* 219 */ "",    /* 220 */ "",
  106.     /* 221 */ "",    /* 222 */ "",    /* 223 */ "",    /* 224 */ "",
  107.     /* 225 */ "",    /* 226 */ "",    /* 227 */ "",    /* 228 */ "",
  108.     /* 229 */ "",
  109.     /* 230 */ "File not found (prospero)",
  110.     /* 231 */ "Directory not found (prospero)",
  111.     /* 232 */ "Symbolic links nested too deep (prospero)",
  112.     /* 233 */ "Environment not initialized - source vfsetup.source then run vfsetup",
  113.     /* 234 */ "Can't traverse an external file (prospero)",
  114.     /* 235 */ "Forwarding chain is too long (prospero)",
  115.     /* 236 */ "",    /* 237 */ "",    /* 238 */ "",    /* 239 */ "",
  116.     /* 240 */ "",    /* 241 */ "",
  117.     /* 242 */ "Authentication required (prospero server)",
  118.     /* 243 */ "Not authorized (prospero server)",
  119.     /* 244 */ "Not found (prospero server)",
  120.     /* 245 */ "Bad version number (prospero server)",
  121.     /* 246 */ "Not a directory (prospero server)",
  122.     /* 247 */ "Already exists (prospero server)",
  123.     /* 248 */ "Link with same name already exists (prospero server)",
  124.     /* 249 */ "",    /* 250 */ "",
  125.     /* 251 */ "Command not implemented on server (dirsrv)",
  126.     /* 252 */ "Bad format for response (dirsrv)",
  127.     /* 253 */ "Protocol error (prospero server)",
  128.     /* 254 */ "Unspecified server failure (prospero server)",
  129.     /* 255 */ "Generic Failure (prospero)"
  130. };
  131.  
  132. char    *p_warn_text[256] = {
  133.     /*   0 */ "No warning",
  134.     /*   1 */ "You are using an old version of this program",
  135.     /*   2 */ "From server",
  136.     /*   3 */ "Unrecognized line in response from server",
  137.   /* 4-254 */ "", "", "", "", "", "", "", "", "", "", "", "", "",
  138.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  139.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  140.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  141.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  142.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  143.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  144.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  145.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  146.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  147.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  148.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  149.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  150.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  151.   "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  152.     /* 255 */ ""
  153. };
  154.  
  155. #ifndef ARCHIE
  156. void perrmesg(char *prefix,int no, char *text)
  157. //    char    *prefix;
  158. //    int        no;
  159. //    char    *text;
  160. {
  161.     fprintf(stderr,"%s%s%s%s\n", (prefix ? prefix : ""),
  162.         (no ? p_err_text[no] : p_err_text[perrno]),
  163.         ((text ? (*text ? " - " : "") :
  164.           (!no && *p_err_string ? " - " : ""))),
  165.         (text ? text : (no ? "" : p_err_string)));
  166. }
  167.  
  168. void sperrmesg(char *buf,char *prefix,int no,char *text)
  169. //    char    *buf;
  170. //    char    *prefix;
  171. //    int        no;
  172. //    char    *text;
  173. {
  174.     sprintf(buf,"%s%s%s%s\n", (prefix ? prefix : ""),
  175.         (no ? p_err_text[no] : p_err_text[perrno]),
  176.         ((text ? (*text ? " - " : "") :
  177.           (!no && *p_err_string ? " - " : ""))),
  178.         (text ? text : (no ? "" : p_err_string)));
  179. }
  180.  
  181. void pwarnmesg(char *prefix,int no,char *text)
  182. //    char    *prefix;
  183. //    int        no;
  184. //    char    *text;
  185. {
  186.     fprintf(stderr,"%s%s%s%s\n", (prefix ? prefix : ""),
  187.         (no ? p_warn_text[no] : p_warn_text[pwarn]),
  188.         ((text ? (*text ? " - " : "") :
  189.           (!no && *p_warn_string ? " - " : ""))),
  190.         (text ? text : (no ? "" : p_warn_string)));
  191. }
  192.  
  193. void spwarnmesg(char *buf,char *prefix,int no,char *text)
  194. //    char    *buf;
  195. //    char    *prefix;
  196. //    int        no;
  197. //    char    *text;
  198. {
  199.     sprintf(buf,"%s%s%s%s\n", (prefix ? prefix : ""),
  200.         (no ? p_warn_text[no] : p_warn_text[pwarn]),
  201.         ((text ? (*text ? " - " : "") :
  202.           (!no && *p_warn_string ? " - " : ""))),
  203.         (text ? text : (no ? "" : p_warn_string)));
  204. }
  205. #endif
  206.